package utils;

import java.util.*;

/**
 * Created by Administrator on 2016/4/19 0019.
 */
public class PagesUtils<T> {
    private int pageNum;    // 页码
    private int pageCount;  // 每页显示条数
    private int totalCount;  // 数据总条数
    private List<T> data;   // 数据

    public PagesUtils(int pageNum, int pageCount, int totalCount, List<T> data) {
        this.pageNum = pageNum;
        this.pageCount = pageCount;
        this.totalCount = totalCount;
        this.data = data;
    }
    public PagesUtils(){}

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    /**
     * 获得总页数
     * @return
     */
    public int getTotalPages(){
        return (int)Math.ceil((double)totalCount / pageCount);
    }
}
